package com.tommy.ddp.manager
{
	import flash.events.Event;
	import flash.events.EventDispatcher;

	/**
	 * 游戏状态管理
	 * @author hongxuan
	 * 
	 */	
	public class GameStatusManager
	{
		private static var _dispatch:EventDispatcher;
		
		private static var _status:uint;
		
		public function GameStatusManager()
		{
		}
		
		private static function get dispacth():EventDispatcher
		{
			if(!_dispatch)
			{
				_dispatch = new EventDispatcher();
			}
			return _dispatch;
		}
		
		
		public static function changeStatus(n:uint):void
		{
			_status = n; 
			
			dispacth.dispatchEvent(new Event("GameStatus_"+_status));
		}
		
		
		public static function addGameStatus(type:uint,fun:Function):void
		{
			dispacth.addEventListener("GameStatus_"+type,fun);
		}
		
		public static function removeGameStatus(type:uint,fun:Function):void
		{
			dispacth.removeEventListener("GameStatus_"+type,fun);
		}
	}
}